'use strict';

var express = require('express');
var controller = require('./exam.controller');
var auth = require('../../auth/auth.service');
var router = express.Router();

router.get('/', controller.index);
router.get('/:id', controller.show);
router.get('/count/:klasscode', controller.getCounts);
router.get('/klass/:code/:pageindex/:pagesize', controller.getFromKlasscode);
router.get('/klasslastone/:code', controller.getLastOne);
router.post('/', auth.hasRole('teacher'),controller.create);
router.post('/:id', auth.hasRole('teacher'),controller.update);
router.patch('/:id', auth.hasRole('teacher'),controller.update);
router.delete('/:id', auth.hasRole('teacher'),controller.destroy);

module.exports = router;
